FROM php:7.1-fpm-stretch

COPY aliyun.source.list /etc/apt/sources.list

# 更新阿里云镜像源并安装依赖软件
RUN apt-get -qq update \
&& apt-get -qq install -y \
libwebp-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
nginx 2>&1 > /dev/null

# 拷贝 NGINX 配置文件
COPY php.conf /etc/nginx/conf.d/
COPY virtual_host.conf /etc/nginx/sites-available/default
RUN echo "daemon off;" >> /etc/nginx/nginx.conf

# 安装 PHP 扩展程序
RUN docker-php-ext-configure gd \
-with-freetype-dir=/usr/include/ \
--with-jpeg-dir=/usr/include/ > /dev/null 2>&1 \
&& docker-php-ext-install \
gd pdo_mysql mysqli -j$(nproc) > /dev/null 2>&1 \
&& pecl install redis-4.0.1 > /dev/null 2>&1 \
&& docker-php-ext-enable redis > /dev/null 2>&1

COPY run.sh /home/
CMD [ "/home/run.sh" ]
EXPOSE 80




